You are trying to create a MonoBehaviour using the new keyword.

54

You are trying to create a MonoBehaviour using the 'new' keyword. -

DetectPlayer dp;

private void Awake()
{
    GameObject gameObject = new GameObject("DetectPlayer");
    dp = gameObject.AddComponent<DetectPlayer>();
}

Comments

Submit
0 Comments